package es.udc.acs.utils;

import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class LoggerFile {
	
	private Logger logger;
	
	public LoggerFile(String file)  {
		
		logger  = Logger.getLogger("MyLog");
		FileHandler fh;
		
		// directorio actual del proyecto
		String curDir = System.getProperty("user.dir");
    
 
		try {
			fh = new FileHandler(curDir+"/../config/"+file, true);
			logger.addHandler(fh);
			logger.setLevel(Level.ALL);
			SimpleFormatter formatter = new SimpleFormatter();
			fh.setFormatter(formatter);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	public Logger getLogger() {
		
		return logger;
	}
}
